package bsf.baseservice.businessmq.systemruntime.log;

import bsf.baseservice.businessmq.model.tb_log_model;
import bsf.baseservice.businessmq.systemruntime.ConfigHelper;
import bsf.baseservice.businessmq.dal.tb_log_dal;
import bsf.db.DbConn;
import org.apache.commons.lang3.StringUtils;

public class LogHelper
{
	public static void writeLine(int mqpathid, String mqpath, String methodname, String info)
	{
		try
		{
			if (!StringUtils.isEmpty(ConfigHelper.LogDBConnectString))
			{
				try(DbConn c = DbConn.createConn(ConfigHelper.LogDBConnectString))
				{
					tb_log_dal dal = new tb_log_dal();
					tb_log_model t = new tb_log_model();
					t.createtime=new java.util.Date();
					t.info=info;
					t.mqpath=mqpath;
					t.mqpathid=mqpathid;
					t.methodname=methodname;
					dal.add(c, t);
				}

			}
		}
		catch (Exception exp)
		{
			/* 临时注释
			XXF.Log.ErrorLog.Write(String.format("BusinessMQ插入Log信息时发生错误,mqpathid:%1$s,mqpath:%2$s,methodname:%3$s,info:%4$s",
			mqpathid, mqpath.NullToEmpty(), methodname.NullToEmpty(), info.NullToEmpty()), exp);
			*/
		}
		DebugHelper.writeLine(mqpathid, mqpath, methodname, "【记录】:" + info);
	}
}